#define _CRT_SECURE_NO_WARNINGS   1

#include<iostream>
#include<vector>

using namespace std;

struct Node
{
	int data;
	struct Node*next;
};

Node* CreateList(int a[],int n)
{
	Node * rear, *s;
	Node *head = new Node;
	rear = head;
	for (int i = 0; i < n; i++)
	{
		s = new Node;
		s->data = a[i];
		rear->next = s;
		rear = s;
	}
	rear->next = NULL;
	return head;
}
class Solution {
public:
	Node* ReverseList(Node* pHead) 
	{
		Node *pre = nullptr;
		Node *cur = pHead;
		Node *nex = nullptr;
		while (cur) {
			nex = cur->next;
			cur->next = pre;
			pre = cur;
			cur = nex;
		}
		return pre;
	}
};

int main()
{
	Solution sol;
	int num;
	vector<int>a;
	while (cin >> num)
	{
		a.push_back(num);
		if (cin.get() == '\n')
			break;
	}
	int *b;
	b = new int[a.size()];
	for (int i = 0; i < a.size(); i++)
	{
		b[i] = a[i];
	}
	Node *ph=sol.ReverseList(CreateList(b, a.size()));

	Node *p = ph;
	while (p->next!=NULL)
	{
		cout << p->data << "  ";
		p = p->next;
	}
	cout << endl;
}